﻿
package extremefx.ui {
	import extremefx.events.KeyEventArgs;	
	import extremefx.ui.ScrollBar;
	
	import flash.ui.Keyboard;		

	/**
	 * @author Marcelo Volmaro
	 */
	public class HScrollBar extends ScrollBar {
		public function HScrollBar(pParameters:UIParameters = null) {
			__pad1 = "left";
			__pad2 = "right";
			__pad3 = "top";
			__size1 = "height";
			__size2 = "width";
			__pos1 = "y";
			__pos2 = "x";
			__mpos1 = "mouseX";
			__mpos2 = "mouseY";
			
			_fheight = true;
			super("HScrollBar", pParameters);
		}
		
		protected override function _keyDownHandler(pSender:KeyHandler, pArgs:KeyEventArgs):void {
			var pos:int = scrollPosition,
			i:int = pSender.ctrl ? _wSize : _increment;
			
			switch(pArgs.keyboardEvent.keyCode){
				case Keyboard.LEFT:
					scrollPosition = pos - i;
					break;
					
				case Keyboard.RIGHT:
					scrollPosition = pos + i;
			}
		}
	}
}
